package com.dxl.demo241127

import android.os.Bundle
import android.view.View
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.navigation.findNavController
import androidx.navigation.fragment.NavHostFragment

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_main)
//        val navController = findNavController(R.id.fragment_container)
//        findViewById<View>(R.id.btn_nav).setOnClickListener {
//            navController.navigate(R.id.secondFragment)
//        }
        val navController =
            (supportFragmentManager.findFragmentById(R.id.fragment_container) as NavHostFragment).navController

        findViewById<View>(R.id.btn_activity_nav).setOnClickListener {
            navController.navigate(R.id.secondFragment)
        }
    }
}